package com.itheima.imports.config;

import com.itheima.imports.manymany.PackageUtil;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import java.util.Set;

public class MyImportSelector implements ImportSelector {
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        System.out.println("我被执行了!!!");

        /*return new String[]{
                "com.itheima.imports.manymany.Many1Config",
                "com.itheima.imports.manymany.Many2Config",
                "com.itheima.imports.manymany.Many3Config",
                "com.itheima.imports.manymany.Many4Config",
                "com.itheima.imports.manymany.Many5Config",
        };*/

        //写个啥扫描之类 或者 读取自定义配置之类
        Set<String> classes = PackageUtil.findClasses("com.itheima.imports.manymany");

        String[] result=new String[classes.size()];
        classes.toArray(result);


        return result;

    }
}
